bin = httpserver
cgi = test_cgi
cc = g++
LD_FLAGS = -std=c++11 -pthread
src = main.cc
curr = $(shell pwd)

ALL:$(bin) $(cgi)
.PHONY:ALL


$(bin):$(src)
	$(cc) -o $@ $^ $(LD_FLAGS)

$(cgi):$(curr)/cgi/test_cgi.cc
	$(cc) -o $@ $^
	cp $(cgi) wwwroot/

.PHONY:clean
clean:
	rm -f $(bin) $(cgi)
	rm -rf output

.PHONY:output
output:
	mkdir output
	cp -rf wwwroot output/
	cp $(bin) output/
	cp $(cgi) output/wwwroot
	cp -rf cgi output/wwwroot
